import {UserActions} from './user';

const initialState = {};

export const HistoryVendorActions = {
  UPDATE_HISTORY_VENDOR: 'update_history_vendor',
  RESET_HISTORY_VENDOR: 'reset_history_vendor',
};

export function updateHistoryVendor(payload) {
  return {
    type: HistoryVendorActions.UPDATE_HISTORY_VENDOR,
    payload,
  };
}

export function resetHistoryVendor() {
  return {
    type: HistoryVendorActions.RESET_HISTORY_VENDOR,
  };
}

export default function historyVendor(state = initialState, action) {
  switch (action.type) {
    case HistoryVendorActions.UPDATE_HISTORY_VENDOR:
      return {...action.payload};
    case HistoryVendorActions.RESET_HISTORY_VENDOR:
      return {};
    case UserActions.USER_SIGN_OUT:
      return {};
    default:
      return state;
  }
}
